package com.ruoyi.web.controller.applet;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.domain.HospitalSubscribeGroupPurchaseInspectionResults;
import com.ruoyi.system.service.IHospitalSubscribeGroupPurchaseInspectionResultsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 团队订单检查项目结果Controller
 * 
 * @author ruoyi
 * @date 2025-06-12
 */
@RestController
@RequestMapping("/applet/group/purchase/inspection/results")
public class HospitalSubscribeGroupPurchaseInspectionResultsAppletController extends BaseController
{
    @Autowired
    private IHospitalSubscribeGroupPurchaseInspectionResultsService hospitalSubscribeGroupPurchaseInspectionResultsService;

    /**
     * 查询团队订单检查项目结果列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HospitalSubscribeGroupPurchaseInspectionResults hospitalSubscribeGroupPurchaseInspectionResults)
    {
        startPage();
        String phonenumber = SecurityUtils.getLoginUser().getUser().getPhonenumber();
        hospitalSubscribeGroupPurchaseInspectionResults.setPhone(phonenumber);
        List<HospitalSubscribeGroupPurchaseInspectionResults> list = hospitalSubscribeGroupPurchaseInspectionResultsService.selectHospitalSubscribeGroupPurchaseInspectionResultsList(hospitalSubscribeGroupPurchaseInspectionResults);
        return getDataTable(list);
    }

    /**
     * 根据手机号订单号查询团购订单结果
     * @return
     */
    @GetMapping("/getResultsByOrderNoAndPhone")
    public TableDataInfo getResultsByOrderNoAndPhone(@RequestParam("orderNo")String orderNo)
    {
        HospitalSubscribeGroupPurchaseInspectionResults results = new HospitalSubscribeGroupPurchaseInspectionResults();
        results.setPhone(SecurityUtils.getLoginUser().getUser().getPhonenumber());
        results.setOrderNo(orderNo);
        List<HospitalSubscribeGroupPurchaseInspectionResults> list = hospitalSubscribeGroupPurchaseInspectionResultsService.selectHospitalSubscribeGroupPurchaseInspectionResultsList(results);
        return getDataTable(list);
    }
}
